﻿using System;
using PortalCurriculo.Domain;

namespace PortalCurriculo.WebUI.Helpers
{
    public class ProfessionalAccessHelper : GeneralAccess
    {
        public static Profissional ProfessionalLogged
        {
            get { return (Profissional) SessionHelper.Session(SessionHelper.SessionName.ProfissionalLogado); }
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            VerifyAccess();
        }

        private void VerifyAccess()
        {
            Profissional usuario = ProfissionalLogado;
            if (usuario == null)
                Response.Redirect(Professional.HomePage);
        }
    }
}